<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>会员登录</title>
        <link rel="stylesheet" type="text/css" href="/style/home/css/login.css"> 
        <script src="/style/admin/js/jquery.js"></script> 
    </head>
    <body>
        <!-- login -->
        <div class="top center">
            <div class="logo center">
                <a href="./index.html" target="_blank"><img src="/style/home/images/mistore_logo.png" alt=""></a>
            </div>
        </div>
        <form  method="post"  class="form center" onsubmit="return false" id="LogForm">
            <div class="login">
                <div class="login_center">
                    <div class="login_top">
                        <div class="left fl">会员登录</div>
                        <div class="right fr">您还不是我们的会员？<a href="/home/register" target="_self">立即注册</a></div>
                        <div class="clear"></div>
                        <div class="xian center"></div>
                    </div>
                    <div class="login_main center">
                        <div class="username">用户名:&nbsp;<input class="shurukuang" type="text" name="name" placeholder="请输入你的用户名"/></div> 
                        <div class="username">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;<input class="shurukuang" type="password" name="pass" placeholder="请输入你的密码"/></div>
                        <div class="username">
                            <div class="left fl">验证码:&nbsp;<input class="yanzhengma" type="text" name="code" placeholder="请输入验证码"/></div>
                            <div class="right fl"><img onclick="this.src ='{{URL('/admin/login/1')}}?' + new Date().getTime();" src="{{URL('/admin/login/1')}}" id="captcha" /></div> 
                            <div class="clear"></div>
                        </div>
                        <div id="error" style="text-align: center;"></div>
                    </div>
                    <div class="login_submit">
                        <input class="submit" type="submit" onclick="log();" value="立即登录" >
                    </div>

                </div>
            </div>
        </form>
        <footer>
            <div class="copyright">简体 | 繁体 | English | 常见问题</div>
            <div class="copyright">小米公司版权所有-京ICP备10046444-<img src="/style/home/images/ghs.png" alt="">京公网安备11010802020134号-京ICP证110507号</div>

        </footer>
    </body>
    <script>
        function log(){
        str = $("#LogForm").serialize();
        $.post("/home/log", {str:str, '_method':'post', '_token':'{{csrf_token()}}'}, function(data){
        if (data == 1){
        window.location.href = "/home/index";
        }else if(data == 2){ 
        str = "验证码错误";
        $("#error").text(str);
        $("#error").css('color', "red");
        return false;
        }else{
        if (data.pass || data.name){
        str = "用户名或密码错误";
        $("#error").text(str);
        $("#error").css('color', "red");
        return false;
        } 
        }
        })
        }
    </script>
</html>